package com.situ.hr4.w.dao;

import com.situ.hr4.pojo.*;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;

@Mapper
public interface ZWFBdao {
    @Select("select * from config_file_first_kind")
    public List<ConfigFileFirstKind> cx1();

    @Select("select mre_id,major_name,second_kind_name,human_amount,regist_time,deadline from engage_major_release e,config_major c,config_file_second_kind a where e.major_id=c.major_id and e.third_kind_id=a.second_kind_id")
    List<Map> zwfbqc();

    @Select("select * from engage_major_release a,config_file_third_kind b,config_file_second_kind c,\n" +
            "\t\tconfig_file_first_kind d,config_major e,config_major_kind f\n" +
            "\t\twhere a.third_kind_id=b.third_kind_id \n" +
            "\t\tand b.second_kind_id=c.second_kind_id\n" +
            "\t\tand c.first_kind_id=d.first_kind_id\n" +
            "\t\tand a.major_id=e.major_id\n" +
            "\t\tand e.major_kind_id=f.major_kind_id\n" +
            "\t\tand mre_id=#{value}")
    Map queryid(int id);

    @Update("update engage_major_release set engage_type=#{engage_type},human_amount=#{human_amount}," +
            "deadline=#{deadline},changer=#{changer},change_time=#{change_time},"
            +"major_describe=#{major_describe},engage_required=#{engage_required} where mre_id=#{mre_id}")
    void xg(EngageMajorRelease e);

    //根据id删除
    @Delete("delete engage_major_release where mre_id=#{value}")
    void wzwfbsc(int id);

    //通过一级结构id查询二级结构
    @Select("select second_kind_id,second_kind_name from config_file_second_kind a,config_file_first_kind b where a.first_kind_id=b.first_kind_id and a.first_kind_id=#{value}\n")
    List<Map> cx2(int id);

    //通过二级结构id查询三级结构
    @Select("select third_kind_id,third_kind_name from config_file_third_kind where second_kind_id=#{value}\n")
    List<Map> cx3(int id);

    //查询职位分类
    @Select("select * from config_major_kind")
    List<ConfigMajorKind> cxzwfl();

    //通过职位类型id查询职位名称
    @Select("select major_id,major_name from config_major where major_kind_id=#{value}")
    List<ConfigMajor> cxzwmc(int id);

    //职位发布添加
    @Insert("insert into engage_major_release values(#{third_kind_id},#{major_id},#{human_amount},#{engage_type},#{deadline},#{register},#{changer},#{regist_time},#{change_time},#{major_describe},#{engage_required})")
    void zwfbtj(EngageMajorRelease eml);

}
